<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>

<script type="text/javascript">

	$(document).ready(function(){
		$("#adminFoodOrderWayAddBtn").click(function(){
			var lastItemNo = $("#FoodAddTable tr:last").attr("class").replace("FoodOrderWayTr", "");
			
			var newitem = $("#FoodAddTable tr:eq(10)").clone();
			newitem.removeClass();
			newitem.find("td:eq(0)").attr("rowspan", "1");
			newitem.addClass("item" + (parseInt(lastItemNo) + 1));
			
			$("#FoodAddTable").append(newitem);
		});
		
		$("#adminFoodOrderRemoveBtn").live("click", function(){
			var clickedRow = $(this).parent().parent();
			var cls = clickedRow.attr("class");
			
		 	if(clickedRow.find("td:eq(0)").attr("rowspan")){
				if(clickedRow.next().hasClass(cls)){
					clickedRow.next().prepend(clickedRow.find("td:eq(0)"));
				}
			} 
			clickedRow.remove();
			
		});
		
	});


</script>


		<div id="adminMode">
			<div id="FoodAdd">
				<h3>운동 추가</h3>
				<table id="FoodAddTable" style="border: 1px solid gray; width:800px; height:60px;">
					<tr style="height:50px">
						<td>운동명 : </td>
						<td><input type="text"></td>
						<td style="width: 200px">운동 목적 : </td>
						<td style="width: 200px">
							<select>
				                <option value="H">홈트레이닝</option>    
				                <option value="W">Weight Training</option>    
				                <option value="Y">요가</option>
				                <option value="S">스트레칭</option>
				                <option value="D">다이어트</option>
				                <option value="A">유산소 운동</option>    
				            </select>
			            </td>
					</tr>
					
					<tr style="height:50px">
						<td style="width: 200px">운동 사진 : </td>
						<td style="width: 200px">
							<input type="button" value="사진추가">
			            </td>
			        	<td>운동부위 : </td>
			            <td>
							<select>
				                <option value="H">전신 운동</option>    
				                <option value="W">가슴 운동</option>    
				                <option value="Y">등 운동</option>
				                <option value="S">어깨 운동</option>
				                <option value="D">삼두 운동</option>
				                <option value="A">이두 운동</option>
				                <option value="A">복근 운동</option>
				                <option value="A">허리 운동</option>
				                <option value="A">하체 운동</option>    
				            </select>
			            </td>
					</tr>
					
					<tr style="height:50px">
						<td colspan="2" rowspan="4" style="border: 1px solid red"></td>
						<td>시간 : </td>
						<td><input type="text"></td>
					</tr>
					
					<tr style="height:50px">
						<td>횟수 : </td>
						<td><input type="text"></td>
					</tr>
					
					<tr style="height:50px">
						<td>세트수 : </td>
						<td><input type="text"></td>
					</tr>
					
					<tr style="height:50px">
						<td>칼로리소모량(kcal) : </td>
						<td><input type="text"></td>
					</tr>
					<tr style="height:50px">
						<td>운동 설명 : </td>
						<td colspan="3"><textarea cols="77" rows="3"></textarea></td>
					</tr>
					<tr style="height:50px">
						<td>주의 사항 : </td>
						<td colspan="3"><textarea cols="77" rows="3"></textarea></td>
					</tr>
					<tr style="height:50px">
						<td>운동 팁 : </td>
						<td colspan="3"><textarea cols="77" rows="3"></textarea></td>
					</tr>
					<tr>
						<td colspan="3">운동방법 : </td>
						<td align="center" style="padding: 0px 0px 0px 5px;"><button id="adminFoodOrderWayAddBtn">운동방법추가</button></td>
					</tr>
					<tr class="FoodOrderWayTr1">
						<td></td>
						<td colspan="3"><input type="text" size="71" ><button id="adminFoodOrderRemoveBtn">운동방법삭제</button></td>
					</tr>
	
				</table>
				<div id="adminFoodAddBtn" style="margin: 10px 0px 10px 340px">
					<input type="button" value="추 가" style="padding: 5px 15px">
					<input type="button" value="취 소" style="padding: 5px 15px">
				</div>
			</div>
        </div>